package com.psnoted.backend.dto;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * 加密存储数据DTO
 * 对应前端的EncryptedStorageData结构
 *
 * @author PSNoted Team
 * @version 1.0.0
 */
public class EncryptedStorageData {

    @NotBlank(message = "数据版本不能为空")
    private String version;

    @NotBlank(message = "密钥哈希不能为空")
    private String keyHash;

    @NotBlank(message = "加密数据不能为空")
    private String encryptedData;

    @NotNull(message = "时间戳不能为空")
    private Long timestamp;

    // 构造函数
    public EncryptedStorageData() {}

    public EncryptedStorageData(String version, String keyHash, String encryptedData, Long timestamp) {
        this.version = version;
        this.keyHash = keyHash;
        this.encryptedData = encryptedData;
        this.timestamp = timestamp;
    }

    // Getter和Setter方法
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getKeyHash() {
        return keyHash;
    }

    public void setKeyHash(String keyHash) {
        this.keyHash = keyHash;
    }

    public String getEncryptedData() {
        return encryptedData;
    }

    public void setEncryptedData(String encryptedData) {
        this.encryptedData = encryptedData;
    }

    public Long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }

    @Override
    public String toString() {
        return "EncryptedStorageData{" +
                "version='" + version + '\'' +
                ", keyHash='" + keyHash + '\'' +
                ", encryptedData='[PROTECTED]'" +
                ", timestamp=" + timestamp +
                '}';
    }
}